package com.kewu.dao;

import com.kewu.bean.Fileup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface FileUploadMapper {
    @Insert("insert into fileupload(md5,filePath,size) value(#{md5},#{filePath},#{size})")
    public int insertMd5(Fileup fileup);
    @Select("SELECT  * FROM fileupload")
    public List<Fileup> findAll();

    @Select("SELECT  count(*) FROM fileupload")
    public int countAll();

    @Select("SELECT  * FROM fileupload where md5=#{md5} ")
    public Fileup findByMd5(String md5);

    @Select("SELECT  * FROM fileupload where fileid=#{fileid} ")
    public Fileup findById(int fileid);

    @Delete("delete from fileupload where fileid=#{id}")
    public int delectMd5(int id);

    @Select("select sum(fileupload.size) from filerecord.fileupload")
    public int findsize();

}
